﻿using Abp.Configuration;
using Abp.Net.Mail;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;

namespace HCD.Configuration
{
    public class HostEmailSettingProvider : SettingProvider
    {
        /// <summary>
        /// 读取appsetting.json配置
        /// </summary>
        public IConfiguration Configuration { get; set; }

        public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
        {
            return new[]
            {
                new SettingDefinition(EmailSettingNames.DefaultFromAddress, Configuration["HostEmailSetting:DefaultFromAddress"]),
                new SettingDefinition(EmailSettingNames.DefaultFromDisplayName, Configuration["HostEmailSetting:DefaultFromDisplayName"]),
                new SettingDefinition(EmailSettingNames.Smtp.Host, Configuration["HostEmailSetting:Smtp.Host"]),
                new SettingDefinition(EmailSettingNames.Smtp.Port, Configuration["HostEmailSetting:Smtp.Port"]),
                new SettingDefinition(EmailSettingNames.Smtp.UserName,Configuration["HostEmailSetting:Smtp.UserName"]),
                new SettingDefinition(EmailSettingNames.Smtp.Password, Configuration["HostEmailSetting:Smtp.Password"]),
                new SettingDefinition(EmailSettingNames.Smtp.Domain, Configuration["HostEmailSetting:Smtp.Domain"]),
                new SettingDefinition(EmailSettingNames.Smtp.EnableSsl, Configuration["HostEmailSetting:Smtp.EnableSsl"]),
                new SettingDefinition(EmailSettingNames.Smtp.UseDefaultCredentials,Configuration["HostEmailSetting:Smtp.UseDefaultCredentials"])
            };
        }
    }
}
